
<style lang="less">
  .page__wrapper {
    width: 100%;
    height: 100%;
  }
</style>
<template>
  <div class="page__wrapper">
    <simple-table :table-column="tableColumn" :table-data="tableData" :pageable="false">
      <template slot="searchSection">
        <simple-form v-model="searchModel" :form-field="searchFormField">
          <template slot="tableOperation">
            <el-button @click="handleDataSearch">{{$t('operation.search')}}</el-button>
          </template>
        </simple-form>
      </template>
    </simple-table>
  </div>
</template>
<script>
// import Axios from 'axios'
const BASEURL = {
  list: `/Web/BizController/ajax.html?sys_method=GetListBySql&sys_objName=Biz_Factory_Collective`,
  getInitConfig: '/Web/SysAdmin/ajax.html?sys_method=GetInitConfig',
  getCombobox: '/Web/SysAdmin/ajax.html?sys_method=GetCombobox'
}
export default {
  name: 'unlisted_operate_report',
  components: {},
  data () {
    return {
      searchModel: {},
      /** 表格数据 */
      tableData: [],

      actionList: [],
      sys_mid: '',
      orgList: []
    }
  },
  computed: {
    searchFormField () {
      return [
        { prop: 'companyname', label: this.$t('balance_factory.companyname'), type: 'Select', component: { clearable: true, optionList: this.orgList } },
        { prop: 'uploadyear', label: this.$t('balance_factory.uploadyear'), type: 'Datepicker', component: { clearable: true, type: 'year', valueFormat: 'yyyy' } },
        { prop: 'uploadquarter', label: this.$t('balance_factory.uploadquarter'), type: 'Select', component: { clearable: true, optionList: this.$getDictList('季度') } },
        { slotName: 'tableOperation', col: { span: 6, style: { textAlign: 'right' } }, labelWidth: '0' }
      ]
    },
    tableColumn () {
      return [
        { prop: 'companyname', label: '项目', width: 180 },
        { prop: 'xxx', label: '行次', width: 100 },
        { prop: 'xxx', label: '本月数' },
        { prop: 'xxx', label: '本年累计' },
        { prop: 'xxx', label: '上年同期' }
      ]
    }
  },
  methods: {
    handleDataSearch () {
      let params = Object.assign({}, { sys_mid: this.sys_mid, UserID: this.$store.state.app.userInfo.userid }, { sys_search: this.searchModel })

      let loadingFlag = this.$loading({ fullscreen: false, target: this.$el, text: this.$t('tip.systemLoading') })
      this.$axios
        .post(BASEURL.list, params)
        .then(resp => {
          this.tableData = resp.rows
        })
        .finally(() => {
          loadingFlag.close()
        })
    },
    handleInitData () {
      // let configLoadingFlag = this.$loading({ fullscreen: false, target: this.$el, text: this.$t('tip.systemLoading') })
      // this.$axios.post(BASEURL.getInitConfig)
      //   .then(resp => {
      //     this.actionList = resp.actionKeys.split(',')
      //     this.sys_mid = resp.mid

      //     /** 设置列表及涉及主数据请求参数 */
      //     let params = Object.assign({},{ sys_mid: resp.mid, UserID: this.$store.state.app.userInfo.userid })
      //     let comboParams = { sys_json: JSON.stringify([{ ObjName: 'C_SYS_Role' }, { ObjName: 'C_SYS_Org' }]) }
      //     let loadingFlag = this.$loading({ fullscreen: false, target: this.$el, text: this.$t('tip.systemLoading') })

      //     Axios.all([
      //       this.$axios.post(BASEURL.getCombobox, comboParams),
      //       this.$axios.post(BASEURL.list, params)
      //     ])
      //       .then(Axios.spread((comboData, pageData) => {
      //         this.orgList = comboData.C_SYS_Org

      //         this.tableData = pageData.rows
      //         this.tableDataTotalCount = pageData.total
      //       }))
      //       .finally(() => {
      //         loadingFlag.close()
      //       })
      //   })
      //   .finally(() => {
      //     configLoadingFlag.close()
      //   })
      this.$set(this, 'tableData', [])
    }
  },
  mounted () {
    this.handleInitData()
  }
}
</script>
